package com.example.ali.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.allure.lbanners.LMBanners;
import com.allure.lbanners.adapter.LBaseAdapter;
import com.example.ali.R;
import com.example.ali.entiy.School;


/**
 * Created by luomin on 16/7/12.
 */
public class StudentBannerAdapter implements LBaseAdapter<Object> {
    private Context mContext;

    public StudentBannerAdapter(Context context) {
        mContext = context;
    }


    @Override
    public View getView(LMBanners lBanners, Context context, int position, Object data) {
        School school = (School) data;
        //Log.i("---->",""+ JSON.toJSONString(student));
        View view = LayoutInflater.from(mContext).inflate(R.layout.student_banner_item, null);
        LinearLayout linearLayout = view.findViewById(R.id.school);
        ImageView imageView1 = (ImageView) view.findViewById(R.id.img1);
        ImageView imageView2 = (ImageView) view.findViewById(R.id.img2);
        ImageView imageView3 = (ImageView) view.findViewById(R.id.img3);
        TextView tile = (TextView) view.findViewById(R.id.title);
        TextView time = (TextView) view.findViewById(R.id.time);
        TextView content = (TextView) view.findViewById(R.id.content);

        imageView1.setImageResource(school.getImg()[0]);
        imageView2.setImageResource(school.getImg()[1]);
        imageView3.setImageResource(school.getImg()[2]);

        tile.setText(school.getTitle());
        time.setText(school.getData());
        content.setText(school.getContent());
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        return view;
    }
}

